<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class RegisterRequest extends FormRequest
{
    public function authorize(): bool
    {
        return true;
    }

    public function rules(): array
    {
        return [
            'name' => 'required|string',
            'email' => 'required|string',
            'password' => 'required|string|min:6',
        ];
    }

    public function messages()
    {
        return [
            'name.required' => '姓名是必填的。',
            'email.required' => '电子邮件地址是必填的。',
            'email.email' => '请输入有效的电子邮件地址。',
            'email.unique' => '电子邮件地址已被注册。',
            'password.required' => '密码是必填的。',
            'password.confirmed' => '密码不匹配。',
            'password.regex' => '密码必须包含数字和特殊字符。',
        ];
    }
}
